<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>提交作业 - 学习资源平台</title>
    <link rel="stylesheet" th:href="@{/css/common.css}">
    <link rel="stylesheet" th:href="@{/css/navbar.css}">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <link rel="stylesheet" th:href="@{/css/assignmentsubmit.css}">
</head>
<body>
<div class="container">
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg">
        <div class="container">
            <a class="navbar-brand" href="#">云学堂</a>
            <div class="collapse navbar-collapse">
                <ul class="navbar-nav mr-auto">
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/resource/list}">学习资源</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link active" th:href="@{/assignment/list}">作业与考试</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/forum/list}">交流互动</a>
                    </li>
                    <li class="nav-item" th:if="${session.identity=='superAdmin' || session.identity=='ordinaryAdmin'}">
                        <a class="nav-link" th:href="@{/admin/index}">管理中心</a>
                    </li>
                </ul>
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/user/digital}">个人中心</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/user/logout}">退出</a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <!-- 主内容 -->
    <div class="row mt-4">
        <div class="col-12">
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a th:href="@{/assignment/list}">作业列表</a></li>
                    <li class="breadcrumb-item active" th:text="${assignment.title}">作业标题</li>
                </ol>
            </nav>
            
            <div class="card">
                <div class="card-header">
                    <h3>提交作业: <span th:text="${assignment.title}" class="assignment-title">作业标题</span></h3>
                </div>
                <div class="card-body">
                    <div class="row mb-4">
                        <div class="col-md-12">
                            <p><strong>作业描述:</strong></p>
                            <p th:text="${assignment.description ?: '暂无描述'}">作业描述内容</p>
                            
                            <p><strong>截止时间:</strong> 
                                <span th:text="${#temporals.format(assignment.deadline, 'yyyy-MM-dd HH:mm')}">截止时间</span>
                            </p>
                        </div>
                    </div>
                    
                    <form th:action="@{/assignment/submit}" method="post" enctype="multipart/form-data">
                        <input type="hidden" name="assignmentId" th:value="${assignment.id}">
                        
                        <div class="form-group">
                            <label for="file" class="form-label">作业文件</label>
                            <input type="file" class="form-control-file" id="file" name="file" required>
                            <div class="form-text text-muted">请选择要提交的作业文件</div>
                        </div>
                        
                        <button type="submit" class="btn btn-primary">
                            <i class="fas fa-upload me-2"></i>提交作业
                        </button>
                        <a th:href="@{/assignment/list}" class="btn btn-secondary">
                            <i class="fas fa-times me-2"></i>取消
                        </a>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>